home *** CD-ROM | disk | FTP | other *** search
/ Large Pack of OldSkool DOS MOD Trackers / buzzmachines_bigpack_27feb2002.zip / Effects / Edsca Migraine.cpp < prev    next >
C/C++ Source or Header  |  2001-10-08  |  63KB  |  2,598 lines

  1. //Edsca Migraine version 0.5
  2. //October 2001
  3. //This file (and also Edsca Migraine.dll) may not be used in ANY capacity
  4. //for the purpose or with the intention of making a profit,
  5. //without prior written permission from the author:
  6. //Edward Earl machine@emaajne.freeserve.co.uk
  7.  
  8. //DEVELOPERS: If you want to try to clean up this code, please feel free,
  9. //but please mail me if you want to do anything with it (i.e. release it)
  10.  
  11. //Thanks: Cyanphase for his excellent effects tutorial;
  12. //Rymix for invaluable advice;
  13. //Oskari for Buzz ;)
  14.  
  15. #include "../mdk/mdk.h"
  16.  
  17. #include <windows.h>
  18.  
  19. #include <math.h>
  20.  
  21. #include <float.h>
  22.  
  23.  
  24.  
  25. #pragma optimize ("awy", on) 
  26.  
  27. float id = 1e-15;
  28. float tiny = 1e-10;
  29.  
  30.  
  31. CMachineParameter const paraIngain =
  32.  
  33. {
  34.  
  35.             pt_byte,                        // Parameter data type
  36.  
  37.             "Input gain",                        // Parameter name as its shown in the parameter 
  38.  
  39.                                                 // window
  40.  
  41.             "Input amplitude",// Parameter description as its shown in the 
  42.  
  43.                                                 // pattern view's statusbar
  44.  
  45.             0,                                    // Minimum value
  46.  
  47.             0xFE,                        // Maximum value
  48.  
  49.             0xFF,                        // Novalue, this value means "nothing 
  50.  
  51.                                                 // happened" in the mi::Tick procedure
  52.  
  53.             MPF_STATE,                        // Parameter options, MPF_STATE makes it 
  54.  
  55.                                                 // appears as a slider
  56.  
  57.             0x7F                        // the default slider value
  58.  
  59. };
  60.  
  61. CMachineParameter const paraInclip =
  62.  
  63. {
  64.  
  65.             pt_byte,                        // Parameter data type
  66.  
  67.             "In->Soft",                        // Parameter name as its shown in the parameter 
  68.  
  69.                                                 // window
  70.  
  71.             "Input clipping: 0=hard, 1=soft",// Parameter description as its shown in the 
  72.  
  73.                                                 // pattern view's statusbar
  74.  
  75.             0,                                    // Minimum value
  76.  
  77.             1,                        // Maximum value-0=soft, 1=hard, 2=none
  78.  
  79.             0xFF,                        // Novalue, this value means "nothing 
  80.  
  81.                                                 // happened" in the mi::Tick procedure
  82.  
  83.             MPF_STATE,                        // Parameter options, MPF_STATE makes it 
  84.  
  85.                                                 // appears as a slider
  86.  
  87.             0                        // the default slider value
  88.  
  89. };
  90.  
  91.  
  92.  
  93. CMachineParameter const paraCheb2 =
  94.  
  95. {
  96.  
  97.             pt_byte,                        // Parameter data type
  98.  
  99.             "Cheb2 Send",                        // Parameter name as its shown in the parameter 
  100.  
  101.                                                 // window
  102.  
  103.             "Amount sent to Chebyshev Polynomial T2",// Parameter description as its shown in the 
  104.  
  105.                                                 // pattern view's statusbar
  106.  
  107.             0,                                    // Minimum value
  108.  
  109.             0xFE,                        // Maximum value
  110.  
  111.             0xFF,                        // Novalue, this value means "nothing 
  112.  
  113.                                                 // happened" in the mi::Tick procedure
  114.  
  115.             MPF_STATE,                        // Parameter options, MPF_STATE makes it 
  116.  
  117.                                                 // appears as a slider
  118.  
  119.             0x00                        // the default slider value
  120.  
  121. };
  122.  
  123. CMachineParameter const paraCheb2Ret =
  124.  
  125. {
  126.  
  127.             pt_byte,                        // Parameter data type
  128.  
  129.             "Cheb2 Ret",                        // Parameter name as its shown in the parameter 
  130.  
  131.                                                 // window
  132.  
  133.             "Return amount of Chebyshev Polynomial T2",// Parameter description as its shown in the 
  134.  
  135.                                                 // pattern view's statusbar
  136.  
  137.             0,                                    // Minimum value
  138.  
  139.             0xFE,                        // Maximum value
  140.  
  141.             0xFF,                        // Novalue, this value means "nothing 
  142.  
  143.                                                 // happened" in the mi::Tick procedure
  144.  
  145.             MPF_STATE,                        // Parameter options, MPF_STATE makes it 
  146.  
  147.                                                 // appears as a slider
  148.  
  149.             0x0                        // the default slider value
  150.  
  151. };
  152.  
  153.  
  154.  
  155.  
  156.  
  157. CMachineParameter const paraCheb3 =
  158.  
  159. {
  160.  
  161.             pt_byte,                        // Parameter data type
  162.  
  163.             "Cheb3 Send",                        // Parameter name as its shown in the parameter 
  164.  
  165.                                                 // window
  166.  
  167.             "Amount sent to Chebyshev Polynomial T3",// Parameter description as its shown in the 
  168.  
  169.                                                 // pattern view's statusbar
  170.  
  171.             0,                                    // Minimum value
  172.  
  173.             0xFE,                        // Maximum value
  174.  
  175.             0xFF,                        // Novalue, this value means "nothing 
  176.  
  177.                                                 // happened" in the mi::Tick procedure
  178.  
  179.             MPF_STATE,                        // Parameter options, MPF_STATE makes it 
  180.  
  181.                                                 // appears as a slider
  182.  
  183.             0x00                        // the default slider value
  184.  
  185. };
  186.  
  187. CMachineParameter const paraCheb3Ret =
  188.  
  189. {
  190.  
  191.             pt_byte,                        // Parameter data type
  192.  
  193.             "Cheb3 Ret",                        // Parameter name as its shown in the parameter 
  194.  
  195.                                                 // window
  196.  
  197.             "Return amount of Chebyshev Polynomial T3",// Parameter description as its shown in the 
  198.  
  199.                                                 // pattern view's statusbar
  200.  
  201.             0,                                    // Minimum value
  202.  
  203.             0xFE,                        // Maximum value
  204.  
  205.             0xFF,                        // Novalue, this value means "nothing 
  206.  
  207.                                                 // happened" in the mi::Tick procedure
  208.  
  209.             MPF_STATE,                        // Parameter options, MPF_STATE makes it 
  210.  
  211.                                                 // appears as a slider
  212.  
  213.             0x0                        // the default slider value
  214.  
  215. };
  216.  
  217.  
  218.  
  219.  
  220.  
  221. CMachineParameter const paraCheb4 =
  222.  
  223. {
  224.  
  225.             pt_byte,                        // Parameter data type
  226.  
  227.             "Cheb4 Send",                        // Parameter name as its shown in the parameter 
  228.  
  229.                                                 // window
  230.  
  231.             "Amount sent to Chebyshev Polynomial T4",// Parameter description as its shown in the 
  232.  
  233.                                                 // pattern view's statusbar
  234.  
  235.             0,                                    // Minimum value
  236.  
  237.             0xFE,                        // Maximum value
  238.  
  239.             0xFF,                        // Novalue, this value means "nothing 
  240.  
  241.                                                 // happened" in the mi::Tick procedure
  242.  
  243.             MPF_STATE,                        // Parameter options, MPF_STATE makes it 
  244.  
  245.                                                 // appears as a slider
  246.  
  247.             0x00                        // the default slider value
  248.  
  249. };
  250.  
  251. CMachineParameter const paraCheb4Ret =
  252.  
  253. {
  254.  
  255.             pt_byte,                        // Parameter data type
  256.  
  257.             "Cheb4 Ret",                        // Parameter name as its shown in the parameter 
  258.  
  259.                                                 // window
  260.  
  261.             "Return amount of Chebyshev Polynomial T4",// Parameter description as its shown in the 
  262.  
  263.                                                 // pattern view's statusbar
  264.  
  265.             0,                                    // Minimum value
  266.  
  267.             0xFE,                        // Maximum value
  268.  
  269.             0xFF,                        // Novalue, this value means "nothing 
  270.  
  271.                                                 // happened" in the mi::Tick procedure
  272.  
  273.             MPF_STATE,                        // Parameter options, MPF_STATE makes it 
  274.  
  275.                                                 // appears as a slider
  276.  
  277.             0x0                        // the default slider value
  278.  
  279. };
  280.  
  281.  
  282.  
  283.  
  284.  
  285. CMachineParameter const paraCheb5 =
  286.  
  287. {
  288.  
  289.             pt_byte,                        // Parameter data type
  290.  
  291.             "Cheb5 Send",                        // Parameter name as its shown in the parameter 
  292.  
  293.                                                 // window
  294.  
  295.             "Amount sent to Chebyshev Polynomial T5",// Parameter description as its shown in the 
  296.  
  297.                                                 // pattern view's statusbar
  298.  
  299.             0,                                    // Minimum value
  300.  
  301.             0xFE,                        // Maximum value
  302.  
  303.             0xFF,                        // Novalue, this value means "nothing 
  304.  
  305.                                                 // happened" in the mi::Tick procedure
  306.  
  307.             MPF_STATE,                        // Parameter options, MPF_STATE makes it 
  308.  
  309.                                                 // appears as a slider
  310.  
  311.             0x00                        // the default slider value
  312.  
  313. };
  314.  
  315. CMachineParameter const paraCheb5Ret =
  316.  
  317. {
  318.  
  319.             pt_byte,                        // Parameter data type
  320.  
  321.             "Cheb5 Ret",                        // Parameter name as its shown in the parameter 
  322.  
  323.                                                 // window
  324.  
  325.             "Return amount of Chebyshev Polynomial T5",// Parameter description as its shown in the 
  326.  
  327.                                                 // pattern view's statusbar
  328.  
  329.             0,                                    // Minimum value
  330.  
  331.             0xFE,                        // Maximum value
  332.  
  333.             0xFF,                        // Novalue, this value means "nothing 
  334.  
  335.                                                 // happened" in the mi::Tick procedure
  336.  
  337.             MPF_STATE,                        // Parameter options, MPF_STATE makes it 
  338.  
  339.                                                 // appears as a slider
  340.  
  341.             0x0                        // the default slider value
  342.  
  343. };
  344.  
  345.  
  346.  
  347.  
  348.  
  349. CMachineParameter const paraCheb6 =
  350.  
  351. {
  352.  
  353.             pt_byte,                        // Parameter data type
  354.  
  355.             "Cheb6 Send",                        // Parameter name as its shown in the parameter 
  356.  
  357.                                                 // window
  358.  
  359.             "Amount sent to Chebyshev Polynomial T6",// Parameter description as its shown in the 
  360.  
  361.                                                 // pattern view's statusbar
  362.  
  363.             0,                                    // Minimum value
  364.  
  365.             0xFE,                        // Maximum value
  366.  
  367.             0xFF,                        // Novalue, this value means "nothing 
  368.  
  369.                                                 // happened" in the mi::Tick procedure
  370.  
  371.             MPF_STATE,                        // Parameter options, MPF_STATE makes it 
  372.  
  373.                                                 // appears as a slider
  374.  
  375.             0x00                        // the default slider value
  376.  
  377. };
  378.  
  379. CMachineParameter const paraCheb6Ret =
  380.  
  381. {
  382.  
  383.             pt_byte,                        // Parameter data type
  384.  
  385.             "Cheb6 Ret",                        // Parameter name as its shown in the parameter 
  386.  
  387.                                                 // window
  388.  
  389.             "Return amount of Chebyshev Polynomial T6",// Parameter description as its shown in the 
  390.  
  391.                                                 // pattern view's statusbar
  392.  
  393.             0,                                    // Minimum value
  394.  
  395.             0xFE,                        // Maximum value
  396.  
  397.             0xFF,                        // Novalue, this value means "nothing 
  398.  
  399.                                                 // happened" in the mi::Tick procedure
  400.  
  401.             MPF_STATE,                        // Parameter options, MPF_STATE makes it 
  402.  
  403.                                                 // appears as a slider
  404.  
  405.             0x0                        // the default slider value
  406.  
  407. };
  408.  
  409.  
  410.  
  411.  
  412. CMachineParameter const paraCheb7 =
  413.  
  414. {
  415.  
  416.             pt_byte,                        // Parameter data type
  417.  
  418.             "Cheb7 Send",                        // Parameter name as its shown in the parameter 
  419.  
  420.                                                 // window
  421.  
  422.             "Amount sent to Chebyshev Polynomial T7",// Parameter description as its shown in the 
  423.  
  424.                                                 // pattern view's statusbar
  425.  
  426.             0,                                    // Minimum value
  427.  
  428.             0xFE,                        // Maximum value
  429.  
  430.             0xFF,                        // Novalue, this value means "nothing 
  431.  
  432.                                                 // happened" in the mi::Tick procedure
  433.  
  434.             MPF_STATE,                        // Parameter options, MPF_STATE makes it 
  435.  
  436.                                                 // appears as a slider
  437.  
  438.             0x00                        // the default slider value
  439.  
  440. };
  441.  
  442. CMachineParameter const paraCheb7Ret =
  443.  
  444. {
  445.  
  446.             pt_byte,                        // Parameter data type
  447.  
  448.             "Cheb7 Ret",                        // Parameter name as its shown in the parameter 
  449.  
  450.                                                 // window
  451.  
  452.             "Return amount of Chebyshev Polynomial T7",// Parameter description as its shown in the 
  453.  
  454.                                                 // pattern view's statusbar
  455.  
  456.             0,                                    // Minimum value
  457.  
  458.             0xFE,                        // Maximum value
  459.  
  460.             0xFF,                        // Novalue, this value means "nothing 
  461.  
  462.                                                 // happened" in the mi::Tick procedure
  463.  
  464.             MPF_STATE,                        // Parameter options, MPF_STATE makes it 
  465.  
  466.                                                 // appears as a slider
  467.  
  468.             0x0                        // the default slider value
  469.  
  470. };
  471.  
  472.  
  473.  
  474.  
  475. CMachineParameter const paraCheb8 =
  476.  
  477. {
  478.  
  479.             pt_byte,                        // Parameter data type
  480.  
  481.             "Cheb8 Send",                        // Parameter name as its shown in the parameter 
  482.  
  483.                                                 // window
  484.  
  485.             "Amount sent to Chebyshev Polynomial T8",// Parameter description as its shown in the 
  486.  
  487.                                                 // pattern view's statusbar
  488.  
  489.             0,                                    // Minimum value
  490.  
  491.             0xFE,                        // Maximum value
  492.  
  493.             0xFF,                        // Novalue, this value means "nothing 
  494.  
  495.                                                 // happened" in the mi::Tick procedure
  496.  
  497.             MPF_STATE,                        // Parameter options, MPF_STATE makes it 
  498.  
  499.                                                 // appears as a slider
  500.  
  501.             0x00                        // the default slider value
  502.  
  503. };
  504.  
  505. CMachineParameter const paraCheb8Ret =
  506.  
  507. {
  508.  
  509.             pt_byte,                        // Parameter data type
  510.  
  511.             "Cheb8 Ret",                        // Parameter name as its shown in the parameter 
  512.  
  513.                                                 // window
  514.  
  515.             "Return amount of Chebyshev Polynomial T8",// Parameter description as its shown in the 
  516.  
  517.                                                 // pattern view's statusbar
  518.  
  519.             0,                                    // Minimum value
  520.  
  521.             0xFE,                        // Maximum value
  522.  
  523.             0xFF,                        // Novalue, this value means "nothing 
  524.  
  525.                                                 // happened" in the mi::Tick procedure
  526.  
  527.             MPF_STATE,                        // Parameter options, MPF_STATE makes it 
  528.  
  529.                                                 // appears as a slider
  530.  
  531.             0x0                        // the default slider value
  532.  
  533. };
  534.  
  535.  
  536. CMachineParameter const paraLeg2 =
  537.  
  538. {
  539.  
  540.             pt_byte,                        // Parameter data type
  541.  
  542.             "Leg2 Send",                        // Parameter name as its shown in the parameter 
  543.  
  544.                                                 // window
  545.  
  546.             "Amount sent to Legendre Polynomial P2",// Parameter description as its shown in the 
  547.  
  548.                                                 // pattern view's statusbar
  549.  
  550.             0,                                    // Minimum value
  551.  
  552.             0xFE,                        // Maximum value
  553.  
  554.             0xFF,                        // Novalue, this value means "nothing 
  555.  
  556.                                                 // happened" in the mi::Tick procedure
  557.  
  558.             MPF_STATE,                        // Parameter options, MPF_STATE makes it 
  559.  
  560.                                                 // appears as a slider
  561.  
  562.             0x00                        // the default slider value
  563.  
  564. };
  565.  
  566. CMachineParameter const paraLeg2Ret =
  567.  
  568. {
  569.  
  570.             pt_byte,                        // Parameter data type
  571.  
  572.             "Leg2 Ret",                        // Parameter name as its shown in the parameter 
  573.  
  574.                                                 // window
  575.  
  576.             "Return amount of Legendre Polynomial P2",// Parameter description as its shown in the 
  577.  
  578.                                                 // pattern view's statusbar
  579.  
  580.             0,                                    // Minimum value
  581.  
  582.             0xFE,                        // Maximum value
  583.  
  584.             0xFF,                        // Novalue, this value means "nothing 
  585.  
  586.                                                 // happened" in the mi::Tick procedure
  587.  
  588.             MPF_STATE,                        // Parameter options, MPF_STATE makes it 
  589.  
  590.                                                 // appears as a slider
  591.  
  592.             0x0                        // the default slider value
  593.  
  594. };
  595.  
  596.  
  597.  
  598.  
  599.  
  600. CMachineParameter const paraLeg3 =
  601.  
  602. {
  603.  
  604.             pt_byte,                        // Parameter data type
  605.  
  606.             "Leg3 Send",                        // Parameter name as its shown in the parameter 
  607.  
  608.                                                 // window
  609.  
  610.             "Amount sent to Legendre Polynomial P3",// Parameter description as its shown in the 
  611.  
  612.                                                 // pattern view's statusbar
  613.  
  614.             0,                                    // Minimum value
  615.  
  616.             0xFE,                        // Maximum value
  617.  
  618.             0xFF,                        // Novalue, this value means "nothing 
  619.  
  620.                                                 // happened" in the mi::Tick procedure
  621.  
  622.             MPF_STATE,                        // Parameter options, MPF_STATE makes it 
  623.  
  624.                                                 // appears as a slider
  625.  
  626.             0x00                        // the default slider value
  627.  
  628. };
  629.  
  630. CMachineParameter const paraLeg3Ret =
  631.  
  632. {
  633.  
  634.             pt_byte,                        // Parameter data type
  635.  
  636.             "Leg3 Ret",                        // Parameter name as its shown in the parameter 
  637.  
  638.                                                 // window
  639.  
  640.             "Return amount of Legendre Polynomial P3",// Parameter description as its shown in the 
  641.  
  642.                                                 // pattern view's statusbar
  643.  
  644.             0,                                    // Minimum value
  645.  
  646.             0xFE,                        // Maximum value
  647.  
  648.             0xFF,                        // Novalue, this value means "nothing 
  649.  
  650.                                                 // happened" in the mi::Tick procedure
  651.  
  652.             MPF_STATE,                        // Parameter options, MPF_STATE makes it 
  653.  
  654.                                                 // appears as a slider
  655.  
  656.             0x0                        // the default slider value
  657.  
  658. };
  659.  
  660.  
  661.  
  662.  
  663.  
  664. CMachineParameter const paraLeg4 =
  665.  
  666. {
  667.  
  668.             pt_byte,                        // Parameter data type
  669.  
  670.             "Leg4 Send",                        // Parameter name as its shown in the parameter 
  671.  
  672.                                                 // window
  673.  
  674.             "Amount sent to Legendre Polynomial P4",// Parameter description as its shown in the 
  675.  
  676.                                                 // pattern view's statusbar
  677.  
  678.             0,                                    // Minimum value
  679.  
  680.             0xFE,                        // Maximum value
  681.  
  682.             0xFF,                        // Novalue, this value means "nothing 
  683.  
  684.                                                 // happened" in the mi::Tick procedure
  685.  
  686.             MPF_STATE,                        // Parameter options, MPF_STATE makes it 
  687.  
  688.                                                 // appears as a slider
  689.  
  690.             0x00                        // the default slider value
  691.  
  692. };
  693.  
  694. CMachineParameter const paraLeg4Ret =
  695.  
  696. {
  697.  
  698.             pt_byte,                        // Parameter data type
  699.  
  700.             "Leg4 Ret",                        // Parameter name as its shown in the parameter 
  701.  
  702.                                                 // window
  703.  
  704.             "Return amount of Legendre Polynomial P4",// Parameter description as its shown in the 
  705.  
  706.                                                 // pattern view's statusbar
  707.  
  708.             0,                                    // Minimum value
  709.  
  710.             0xFE,                        // Maximum value
  711.  
  712.             0xFF,                        // Novalue, this value means "nothing 
  713.  
  714.                                                 // happened" in the mi::Tick procedure
  715.  
  716.             MPF_STATE,                        // Parameter options, MPF_STATE makes it 
  717.  
  718.                                                 // appears as a slider
  719.  
  720.             0x0                        // the default slider value
  721.  
  722. };
  723.  
  724.  
  725.  
  726.  
  727.  
  728. CMachineParameter const paraLeg5 =
  729.  
  730. {
  731.  
  732.             pt_byte,                        // Parameter data type
  733.  
  734.             "Leg5 Send",                        // Parameter name as its shown in the parameter 
  735.  
  736.                                                 // window
  737.  
  738.             "Amount sent to Legendre Polynomial P5",// Parameter description as its shown in the 
  739.  
  740.                                                 // pattern view's statusbar
  741.  
  742.             0,                                    // Minimum value
  743.  
  744.             0xFE,                        // Maximum value
  745.  
  746.             0xFF,                        // Novalue, this value means "nothing 
  747.  
  748.                                                 // happened" in the mi::Tick procedure
  749.  
  750.             MPF_STATE,                        // Parameter options, MPF_STATE makes it 
  751.  
  752.                                                 // appears as a slider
  753.  
  754.             0x00                        // the default slider value
  755.  
  756. };
  757.  
  758. CMachineParameter const paraLeg5Ret =
  759.  
  760. {
  761.  
  762.             pt_byte,                        // Parameter data type
  763.  
  764.             "Leg5 Ret",                        // Parameter name as its shown in the parameter 
  765.  
  766.                                                 // window
  767.  
  768.             "Return amount of Legendre Polynomial P5",// Parameter description as its shown in the 
  769.  
  770.                                                 // pattern view's statusbar
  771.  
  772.             0,                                    // Minimum value
  773.  
  774.             0xFE,                        // Maximum value
  775.  
  776.             0xFF,                        // Novalue, this value means "nothing 
  777.  
  778.                                                 // happened" in the mi::Tick procedure
  779.  
  780.             MPF_STATE,                        // Parameter options, MPF_STATE makes it 
  781.  
  782.                                                 // appears as a slider
  783.  
  784.             0x0                        // the default slider value
  785.  
  786. };
  787.  
  788.  
  789.  
  790.  
  791.  
  792. CMachineParameter const paraLeg6 =
  793.  
  794. {
  795.  
  796.             pt_byte,                        // Parameter data type
  797.  
  798.             "Leg6 Send",                        // Parameter name as its shown in the parameter 
  799.  
  800.                                                 // window
  801.  
  802.             "Amount sent to Legendre Polynomial P6",// Parameter description as its shown in the 
  803.  
  804.                                                 // pattern view's statusbar
  805.  
  806.             0,                                    // Minimum value
  807.  
  808.             0xFE,                        // Maximum value
  809.  
  810.             0xFF,                        // Novalue, this value means "nothing 
  811.  
  812.                                                 // happened" in the mi::Tick procedure
  813.  
  814.             MPF_STATE,                        // Parameter options, MPF_STATE makes it 
  815.  
  816.                                                 // appears as a slider
  817.  
  818.             0x00                        // the default slider value
  819.  
  820. };
  821.  
  822. CMachineParameter const paraLeg6Ret =
  823.  
  824. {
  825.  
  826.             pt_byte,                        // Parameter data type
  827.  
  828.             "Leg6 Ret",                        // Parameter name as its shown in the parameter 
  829.  
  830.                                                 // window
  831.  
  832.             "Return amount of Legendre Polynomial P6",// Parameter description as its shown in the 
  833.  
  834.                                                 // pattern view's statusbar
  835.  
  836.             0,                                    // Minimum value
  837.  
  838.             0xFE,                        // Maximum value
  839.  
  840.             0xFF,                        // Novalue, this value means "nothing 
  841.  
  842.                                                 // happened" in the mi::Tick procedure
  843.  
  844.             MPF_STATE,                        // Parameter options, MPF_STATE makes it 
  845.  
  846.                                                 // appears as a slider
  847.  
  848.             0x0                        // the default slider value
  849.  
  850. };
  851.  
  852.  
  853.  
  854.  
  855. CMachineParameter const paraLeg7 =
  856.  
  857. {
  858.  
  859.             pt_byte,                        // Parameter data type
  860.  
  861.             "Leg7 Send",                        // Parameter name as its shown in the parameter 
  862.  
  863.                                                 // window
  864.  
  865.             "Amount sent to Legendre Polynomial P7",// Parameter description as its shown in the 
  866.  
  867.                                                 // pattern view's statusbar
  868.  
  869.             0,                                    // Minimum value
  870.  
  871.             0xFE,                        // Maximum value
  872.  
  873.             0xFF,                        // Novalue, this value means "nothing 
  874.  
  875.                                                 // happened" in the mi::Tick procedure
  876.  
  877.             MPF_STATE,                        // Parameter options, MPF_STATE makes it 
  878.  
  879.                                                 // appears as a slider
  880.  
  881.             0x00                        // the default slider value
  882.  
  883. };
  884.  
  885. CMachineParameter const paraLeg7Ret =
  886.  
  887. {
  888.  
  889.             pt_byte,                        // Parameter data type
  890.  
  891.             "Leg7 Ret",                        // Parameter name as its shown in the parameter 
  892.  
  893.                                                 // window
  894.  
  895.             "Return amount of Legendre Polynomial P7",// Parameter description as its shown in the 
  896.  
  897.                                                 // pattern view's statusbar
  898.  
  899.             0,                                    // Minimum value
  900.  
  901.             0xFE,                        // Maximum value
  902.  
  903.             0xFF,                        // Novalue, this value means "nothing 
  904.  
  905.                                                 // happened" in the mi::Tick procedure
  906.  
  907.             MPF_STATE,                        // Parameter options, MPF_STATE makes it 
  908.  
  909.                                                 // appears as a slider
  910.  
  911.             0x0                        // the default slider value
  912.  
  913. };
  914.  
  915.  
  916.  
  917.  
  918. CMachineParameter const paraLeg8 =
  919.  
  920. {
  921.  
  922.             pt_byte,                        // Parameter data type
  923.  
  924.             "Leg8 Send",                        // Parameter name as its shown in the parameter 
  925.  
  926.                                                 // window
  927.  
  928.             "Amount sent to Legendre Polynomial P8",// Parameter description as its shown in the 
  929.  
  930.                                                 // pattern view's statusbar
  931.  
  932.             0,                                    // Minimum value
  933.  
  934.             0xFE,                        // Maximum value
  935.  
  936.             0xFF,                        // Novalue, this value means "nothing 
  937.  
  938.                                                 // happened" in the mi::Tick procedure
  939.  
  940.             MPF_STATE,                        // Parameter options, MPF_STATE makes it 
  941.  
  942.                                                 // appears as a slider
  943.  
  944.             0x00                        // the default slider value
  945.  
  946. };
  947.  
  948. CMachineParameter const paraLeg8Ret =
  949.  
  950. {
  951.  
  952.             pt_byte,                        // Parameter data type
  953.  
  954.             "Leg8 Ret",                        // Parameter name as its shown in the parameter 
  955.  
  956.                                                 // window
  957.  
  958.             "Return amount of Legendre Polynomial P8",// Parameter description as its shown in the 
  959.  
  960.                                                 // pattern view's statusbar
  961.  
  962.             0,                                    // Minimum value
  963.  
  964.             0xFE,                        // Maximum value
  965.  
  966.             0xFF,                        // Novalue, this value means "nothing 
  967.  
  968.                                                 // happened" in the mi::Tick procedure
  969.  
  970.             MPF_STATE,                        // Parameter options, MPF_STATE makes it 
  971.  
  972.                                                 // appears as a slider
  973.  
  974.             0x0                        // the default slider value
  975.  
  976. };
  977.  
  978.  
  979.  
  980.  
  981. CMachineParameter const paraDry =
  982.  
  983. {
  984.  
  985.             pt_byte,                        // Parameter data type
  986.  
  987.             "Dry Amp",                        // Parameter name as its shown in the parameter 
  988.  
  989.                                                 // window
  990.  
  991.             "Amplitude of Dry Signal",// Parameter description as its shown in the 
  992.  
  993.                                                 // pattern view's statusbar
  994.  
  995.             0,                                    // Minimum value
  996.  
  997.             0xFE,                        // Maximum value
  998.  
  999.             0xFF,                        // Novalue, this value means "nothing 
  1000.  
  1001.                                                 // happened" in the mi::Tick procedure
  1002.  
  1003.             MPF_STATE,                        // Parameter options, MPF_STATE makes it 
  1004.  
  1005.                                                 // appears as a slider
  1006.  
  1007.             0x7F                        // the default slider value
  1008.  
  1009. };
  1010.  
  1011. CMachineParameter const paraWet =
  1012.  
  1013. {
  1014.  
  1015.             pt_byte,                        // Parameter data type
  1016.  
  1017.             "Wet Amp",                        // Parameter name as its shown in the parameter 
  1018.  
  1019.                                                 // window
  1020.  
  1021.             "Amplitude of Wet Signal",// Parameter description as its shown in the 
  1022.  
  1023.                                                 // pattern view's statusbar
  1024.  
  1025.             0,                                    // Minimum value
  1026.  
  1027.             0xFE,                        // Maximum value
  1028.  
  1029.             0xFF,                        // Novalue, this value means "nothing 
  1030.  
  1031.                                                 // happened" in the mi::Tick procedure
  1032.  
  1033.             MPF_STATE,                        // Parameter options, MPF_STATE makes it 
  1034.  
  1035.                                                 // appears as a slider
  1036.  
  1037.             0x7F                        // the default slider value
  1038.  
  1039. };
  1040.  
  1041. CMachineParameter const paraOutclip =
  1042.  
  1043. {
  1044.  
  1045.             pt_byte,                        // Parameter data type
  1046.  
  1047.             "Out->Soft",                        // Parameter name as its shown in the parameter 
  1048.  
  1049.                                                 // window
  1050.  
  1051.             "Output clipping: 0=hard, 1=soft",// Parameter description as its shown in the 
  1052.  
  1053.                                                 // pattern view's statusbar
  1054.  
  1055.             0,                                    // Minimum value
  1056.  
  1057.             1,                        // Maximum value-0=soft, 1=hard, 2=none
  1058.  
  1059.             0xFF,                        // Novalue, this value means "nothing 
  1060.  
  1061.                                                 // happened" in the mi::Tick procedure
  1062.  
  1063.             MPF_STATE,                        // Parameter options, MPF_STATE makes it 
  1064.  
  1065.                                                 // appears as a slider
  1066.  
  1067.             0                        // the default slider value
  1068.  
  1069. };
  1070.  
  1071.  
  1072. CMachineParameter const *pParameters[] = {
  1073.  
  1074.             ¶Ingain,
  1075.  
  1076.     ¶Inclip,
  1077.  
  1078.     ¶Cheb2,
  1079.  
  1080.     ¶Cheb2Ret,
  1081.  
  1082.             ¶Cheb3,
  1083.  
  1084.     ¶Cheb3Ret,
  1085.  
  1086.             ¶Cheb4,
  1087.  
  1088.     ¶Cheb4Ret,
  1089.  
  1090.             ¶Cheb5,
  1091.  
  1092.     ¶Cheb5Ret,
  1093.  
  1094.             ¶Cheb6,
  1095.  
  1096.     ¶Cheb6Ret,
  1097.  
  1098.             ¶Cheb7,
  1099.  
  1100.     ¶Cheb7Ret,
  1101.  
  1102.             ¶Cheb8,
  1103.  
  1104.     ¶Cheb8Ret,
  1105.  
  1106.     ¶Leg2,
  1107.  
  1108.     ¶Leg2Ret,
  1109.  
  1110.             ¶Leg3,
  1111.  
  1112.     ¶Leg3Ret,
  1113.  
  1114.             ¶Leg4,
  1115.  
  1116.     ¶Leg4Ret,
  1117.  
  1118.             ¶Leg5,
  1119.  
  1120.     ¶Leg5Ret,
  1121.  
  1122.             ¶Leg6,
  1123.  
  1124.     ¶Leg6Ret,
  1125.  
  1126.             ¶Leg7,
  1127.  
  1128.     ¶Leg7Ret,
  1129.  
  1130.             ¶Leg8,
  1131.  
  1132.     ¶Leg8Ret,
  1133.  
  1134. ¶Dry,
  1135.  
  1136. ¶Wet,
  1137.  
  1138. ¶Outclip
  1139.  
  1140. };
  1141.  
  1142. CMachineAttribute const *pAttributes[] = { NULL };
  1143.  
  1144.  
  1145.  
  1146. #pragma pack(1)                        
  1147.  
  1148.  
  1149.  
  1150. class gvals 
  1151.  
  1152. {public: byte ingain; byte inclip; byte cheb2; byte cheb2ret; byte cheb3; byte cheb3ret; byte cheb4; byte cheb4ret; byte cheb5; byte cheb5ret; byte cheb6; byte cheb6ret; byte cheb7; byte cheb7ret; byte cheb8; byte cheb8ret; byte leg2; byte leg2ret; byte leg3; byte leg3ret; byte leg4; byte leg4ret; byte leg5; byte leg5ret; byte leg6; byte leg6ret; byte leg7; byte leg7ret; byte leg8; byte leg8ret; byte dry; byte wet; byte outclip;
  1153.  
  1154.  };
  1155.  
  1156.  
  1157.  
  1158. #pragma pack()
  1159.  
  1160.  
  1161.  
  1162. CMachineInfo const MacInfo = 
  1163.  
  1164. {
  1165.  
  1166.             MT_EFFECT,                        // Machine type
  1167.  
  1168.             MI_VERSION,                        // Machine interface version
  1169.  
  1170.             MIF_DOES_INPUT_MIXING,            // Machine flags
  1171.  
  1172.             0,                                    // min tracks
  1173.  
  1174.             0,                                    // max tracks
  1175.  
  1176.             33,                                    // numGlobalParameters
  1177.  
  1178.             0,                                    // numTrackParameters
  1179.  
  1180.             pParameters,            // pointer to parameter stuff
  1181.  
  1182.             0,                                    // numAttributes
  1183.  
  1184.             pAttributes,            // pointer to attribute stuff
  1185.  
  1186.             "Edsca Migraine",            // Full Machine Name
  1187.  
  1188.             "Migraine",                        // Short name
  1189.  
  1190.             "Edsca",            // Author name
  1191.  
  1192.             "&About..."                        // Right click menu commands
  1193.  
  1194. };
  1195.  
  1196.  
  1197.  
  1198.  
  1199.  
  1200. class miex : public CMDKMachineInterfaceEx { };
  1201.  
  1202.  
  1203.  
  1204. class mi : public CMDKMachineInterface
  1205.  
  1206. {
  1207.  
  1208. public:
  1209.  
  1210.             mi();
  1211.  
  1212.             virtual ~mi();
  1213.  
  1214.             virtual void Tick();
  1215.  
  1216.             virtual void MDKInit(CMachineDataInput * const pi);
  1217.  
  1218.             virtual bool MDKWork(float *psamples, int numsamples, int const mode);
  1219.  
  1220.             virtual bool MDKWorkStereo(float *psamples, int numsamples, int const mode);
  1221.  
  1222.             virtual void Command(int const i);
  1223.  
  1224.             virtual void MDKSave(CMachineDataOutput * const po);
  1225.  
  1226.             virtual char const *DescribeValue(int const param, int const value);
  1227.  
  1228.             virtual CMDKMachineInterfaceEx *GetEx() { return &ex; }
  1229.  
  1230.             virtual void OutputModeChanged(bool stereo) {}
  1231.  
  1232.  
  1233.  
  1234. public:
  1235.  
  1236.             miex ex;
  1237.  
  1238.  
  1239.  
  1240. public:
  1241.  
  1242.             float param_ingain;
  1243.  
  1244.         float param_cheb2, param_cheb3, param_cheb4, param_cheb5, param_cheb6;
  1245.  
  1246.             float param_cheb7, param_cheb8, param_dry;
  1247.  
  1248.         float param_cheb2ret, param_cheb3ret, param_cheb4ret, param_cheb5ret, param_cheb6ret;
  1249.  
  1250.         float param_cheb7ret, param_cheb8ret;
  1251.  
  1252.         float param_leg2, param_leg3, param_leg4, param_leg5, param_leg6;
  1253.  
  1254.         float param_leg7, param_leg8;
  1255.  
  1256.         float param_leg2ret, param_leg3ret, param_leg4ret, param_leg5ret;
  1257.  
  1258.         float param_leg6ret, param_leg7ret, param_leg8ret, param_wet;
  1259.  
  1260.         int param_inclip, param_outclip;
  1261.  
  1262.     float coefs[9][14]; //array of coefficients for waveshaping. 
  1263.                 //Use like coefs[power of x][algorithm]
  1264.                 //where algorithm is 0 = cheb2, 1 = cheb3,
  1265.                 // ... 7 = leg2, 8 = leg3... 13 = leg8.
  1266.  
  1267.     float dcspeedL, dcposL, dcspeedR, dcposR;
  1268.  
  1269.     float temp;
  1270.  
  1271.             gvals gval;
  1272.  
  1273. };
  1274.  
  1275.  
  1276.  
  1277. mi::mi() {  GlobalVals = &gval; }
  1278.  
  1279. mi::~mi() { }
  1280.  
  1281.  
  1282.  
  1283. void mi::MDKInit(CMachineDataInput * const pi)
  1284.  
  1285. {
  1286.  
  1287.     int order, alg;
  1288.             SetOutputMode( true ); // No mono sounds
  1289.     param_cheb2 = param_cheb3 = param_cheb4 = param_cheb5 = param_cheb6 = param_cheb7 = param_cheb8 = 0.0f;
  1290.     param_cheb2ret = param_cheb3ret = param_cheb4ret = param_cheb5ret = param_cheb6ret = param_cheb7ret = param_cheb8ret = 0.0f;
  1291.     param_leg2 = param_leg3 = param_leg4 = param_leg5 = param_leg6 = param_leg7 = param_leg8 = 0.0f;
  1292.     param_leg2ret = param_leg3ret = param_leg4ret = param_leg5ret = param_leg6ret = param_leg7ret = param_leg8ret = 0.0f;
  1293.  
  1294.     param_inclip = param_outclip = 0;
  1295.  
  1296.     
  1297. for(order=0; order<9; order++){
  1298.     for(alg =0; alg<14; alg++){
  1299.         coefs[order][alg] = 0.0f;
  1300.     }
  1301. }
  1302.  
  1303.     dcspeedL = 0.0f;
  1304.     dcposL = 0.0f;
  1305.     dcspeedR = 0.0f;
  1306.     dcposR = 0.0f;
  1307.  
  1308. }
  1309.  
  1310.  
  1311.  
  1312. void mi::MDKSave(CMachineDataOutput * const po) { }
  1313.  
  1314.  
  1315.  
  1316. void mi::Tick() {
  1317.  
  1318.  
  1319.  
  1320.             if (gval.cheb2 != 0xFF) { 
  1321.  
  1322.  
  1323.  
  1324.                         param_cheb2 = ((float)gval.cheb2 / 254.0f); 
  1325.  
  1326.             coefs[2][0] = 2.0f * param_cheb2 * param_cheb2 * param_cheb2ret;
  1327.  
  1328.             coefs[0][0] = param_cheb2ret;
  1329.  
  1330.  
  1331.  
  1332.     };
  1333.  
  1334.  
  1335.  
  1336. if (gval.cheb3 != 0xFF) { 
  1337.  
  1338.  
  1339.  
  1340.                         param_cheb3 = ((float)gval.cheb3 / 254.0f); 
  1341.  
  1342.             coefs[1][1] = -3.0f * param_cheb3 * param_cheb3ret;
  1343.  
  1344.             coefs[3][1] = 4.0f * param_cheb3 * param_cheb3 * param_cheb3 * param_cheb3ret;
  1345.  
  1346.             };
  1347.  
  1348.  
  1349.  
  1350. if (gval.cheb4 != 0xFF) { 
  1351.  
  1352.  
  1353.  
  1354.                         param_cheb4 = ((float)gval.cheb4 / 254.0f); 
  1355.  
  1356.             temp = param_cheb4 * param_cheb4;
  1357.  
  1358.             coefs[0][2] = param_cheb4ret;
  1359.  
  1360.             coefs[2][2] = -8.0f * temp * param_cheb4ret;
  1361.  
  1362.             coefs[4][2] = 8.0f * temp * temp * param_cheb4ret;
  1363.  
  1364.  
  1365.  
  1366.             };
  1367.  
  1368.  
  1369.  
  1370. if (gval.cheb5 != 0xFF) { 
  1371.  
  1372.  
  1373.  
  1374.                         param_cheb5 = ((float)gval.cheb5 / 254.0f); 
  1375.  
  1376.             temp = param_cheb5 * param_cheb5;
  1377.  
  1378.             coefs[1][3] = 5.0f * param_cheb5 * param_cheb5ret;
  1379.  
  1380.             coefs[3][3] = -20.0f * temp * param_cheb5 * param_cheb5ret;
  1381.  
  1382.             coefs[5][3] = 16.0f * temp * temp * param_cheb5 * param_cheb5ret;
  1383.  
  1384.  
  1385.  
  1386.             };
  1387.  
  1388.  
  1389.  
  1390. if (gval.cheb6 != 0xFF) { 
  1391.  
  1392.  
  1393.  
  1394.                         param_cheb6 = ((float)gval.cheb6 / 254.0f); 
  1395.  
  1396.             temp = param_cheb6 * param_cheb6;
  1397.  
  1398.             coefs[0][4] = -1.0f * param_cheb6ret;
  1399.  
  1400.             coefs[2][4] = 18.0f * temp * param_cheb6ret;
  1401.  
  1402.             coefs[4][4] = -48.0f * temp * temp * param_cheb6ret;
  1403.  
  1404.             coefs[6][4] = 32.0f * temp * temp * temp * param_cheb6ret;
  1405.  
  1406.  
  1407.  
  1408.             };
  1409.  
  1410.  
  1411.  
  1412. if (gval.cheb7 != 0xFF) { 
  1413.  
  1414.  
  1415.  
  1416.                         param_cheb7 = ((float)gval.cheb7 / 254.0f); 
  1417.  
  1418.             temp = param_cheb7 * param_cheb7;
  1419.  
  1420.             coefs[1][5] = -7.0f * param_cheb7 * param_cheb7ret;
  1421.  
  1422.             coefs[3][5] = 56.0f * param_cheb7 * temp * param_cheb7ret;
  1423.  
  1424.             coefs[5][5] = -112.0f * param_cheb7 * temp * temp * param_cheb7ret;
  1425.  
  1426.             coefs[7][5] = 64.0f * param_cheb7 * temp * temp * temp * param_cheb7ret;
  1427.  
  1428.  
  1429.  
  1430.             };
  1431.  
  1432.  
  1433.  
  1434. if (gval.cheb8 != 0xFF) { 
  1435.  
  1436.  
  1437.  
  1438.                         param_cheb8 = ((float)gval.cheb8 / 254.0f); 
  1439.  
  1440.             temp = param_cheb8 * param_cheb8;
  1441.  
  1442.             coefs[0][6] = param_cheb8ret;
  1443.  
  1444.             coefs[2][6] = -32.0f * temp * param_cheb8ret;
  1445.  
  1446.             coefs[4][6] = 160.0f * temp * temp * param_cheb8ret;
  1447.  
  1448.             coefs[6][6] = -256.0f * temp * temp * temp * param_cheb8ret;
  1449.  
  1450.             coefs[8][6] = 128.0f * temp * temp * temp * temp * param_cheb8ret;
  1451.  
  1452.  
  1453.  
  1454.             };
  1455.  
  1456.  
  1457.  
  1458. if (gval.cheb2ret != 0xFF) { 
  1459.  
  1460.  
  1461.  
  1462.                         param_cheb2ret = ((float)gval.cheb2ret / 254.0f); 
  1463.  
  1464.             coefs[2][0] = 2.0f * param_cheb2 * param_cheb2 * param_cheb2ret;
  1465.  
  1466.             coefs[0][0] = param_cheb2ret;
  1467.  
  1468.  
  1469.  
  1470.             };
  1471.  
  1472.  
  1473.  
  1474. if (gval.cheb3ret != 0xFF) { 
  1475.  
  1476.  
  1477.  
  1478.                         param_cheb3ret = ((float)gval.cheb3ret / 254.0f); 
  1479.  
  1480.             param_cheb3 = ((float)gval.cheb3 / 127.0f) - 1.0f; 
  1481.  
  1482.             coefs[1][1] = -3.0f * param_cheb3 * param_cheb3ret;
  1483.  
  1484.             coefs[3][1] = 4.0f * param_cheb3 * param_cheb3 * param_cheb3 * param_cheb3ret;
  1485.  
  1486.  
  1487.  
  1488.             };
  1489.  
  1490.  
  1491.  
  1492. if (gval.cheb4ret != 0xFF) { 
  1493.  
  1494.  
  1495.  
  1496.                         param_cheb4ret = ((float)gval.cheb4ret / 254.0f); 
  1497.  
  1498.             temp = param_cheb4 * param_cheb4;
  1499.  
  1500.     coefs[0][2] = param_cheb4ret;
  1501.  
  1502.             coefs[2][2] = -8.0f * temp * param_cheb4ret;
  1503.  
  1504.             coefs[4][2] = 8.0f * temp * temp * param_cheb4ret;
  1505.  
  1506.  
  1507.  
  1508.             };
  1509.  
  1510.  
  1511.  
  1512. if (gval.cheb5ret != 0xFF) { 
  1513.  
  1514.  
  1515.  
  1516.                         param_cheb5 = ((float)gval.cheb5ret / 254.0f); 
  1517.  
  1518.             temp = param_cheb5 * param_cheb5;
  1519.  
  1520.             coefs[1][3] = 5.0f * param_cheb5 * param_cheb5ret;
  1521.  
  1522.             coefs[3][3] = -20.0f * temp * param_cheb5 * param_cheb5ret;
  1523.  
  1524.             coefs[5][3] = 16.0f * temp * temp * param_cheb5 * param_cheb5ret;
  1525.  
  1526.  
  1527.  
  1528.             };
  1529.  
  1530.  
  1531.  
  1532. if (gval.cheb6ret != 0xFF) { 
  1533.  
  1534.  
  1535.  
  1536.                         param_cheb6ret = ((float)gval.cheb6ret / 254.0f); 
  1537.  
  1538.             temp = param_cheb6 * param_cheb6;
  1539.  
  1540.             coefs[0][4] = -1.0f * param_cheb6ret;
  1541.  
  1542.             coefs[2][4] = 18.0f * temp * param_cheb6ret;
  1543.  
  1544.             coefs[4][4] = -48.0f * temp * temp * param_cheb6ret;
  1545.  
  1546.             coefs[6][4] = 32.0f * temp * temp * temp * param_cheb6ret;
  1547.  
  1548.  
  1549.  
  1550.             };
  1551.  
  1552.  
  1553.  
  1554. if (gval.cheb7ret != 0xFF) { 
  1555.  
  1556.  
  1557.  
  1558.                         param_cheb7ret = ((float)gval.cheb7ret / 254.0f); 
  1559.  
  1560.             temp = param_cheb7 * param_cheb7;
  1561.  
  1562.             coefs[1][5] = -7.0f * param_cheb7 * param_cheb7ret;
  1563.  
  1564.             coefs[3][5] = 56.0f * param_cheb7 * temp * param_cheb7ret;
  1565.  
  1566.             coefs[5][5] = -112.0f * param_cheb7 * temp * temp * param_cheb7ret;
  1567.  
  1568.             coefs[7][5] = 64.0f * param_cheb7 * temp * temp * temp * param_cheb7ret;
  1569.  
  1570.  
  1571.  
  1572.             };
  1573.  
  1574.  
  1575.  
  1576. if (gval.cheb8ret != 0xFF) { 
  1577.  
  1578.  
  1579.  
  1580.                         param_cheb8ret = ((float)gval.cheb8ret / 254.0f); 
  1581.  
  1582.             temp = param_cheb8 * param_cheb8;
  1583.  
  1584.             coefs[0][6] = param_cheb8ret;
  1585.  
  1586.             coefs[2][6] = -32.0f * temp * param_cheb8ret;
  1587.  
  1588.             coefs[4][6] = 160.0f * temp * temp * param_cheb8ret;
  1589.  
  1590.             coefs[6][6] = -256.0f * temp * temp * temp * param_cheb8ret;
  1591.  
  1592.             coefs[8][6] = 128.0f * temp * temp * temp * temp * param_cheb8ret;
  1593.  
  1594.  
  1595.  
  1596.             };
  1597.  
  1598.  
  1599.  
  1600. if (gval.leg2 != 0xFF) { 
  1601.  
  1602.  
  1603.  
  1604.                         param_leg2 = ((float)gval.leg2 / 254.0f); 
  1605.  
  1606.             coefs[0][7] = -0.5f * param_leg2ret;
  1607.  
  1608.             coefs[2][7] = 1.5f * param_leg2 * param_leg2 * param_leg2ret;
  1609.  
  1610.  
  1611.  
  1612.             };
  1613.  
  1614.  
  1615.  
  1616. if (gval.leg3 != 0xFF) { 
  1617.  
  1618.  
  1619.  
  1620.                         param_leg3 = ((float)gval.leg3 / 254.0f); 
  1621.  
  1622.             coefs[1][8] = -3.0f * param_leg3 * param_leg3ret;
  1623.  
  1624.             coefs[3][8] = 2.5f * param_leg3 * param_leg3 * param_leg3 * param_leg3ret;
  1625.  
  1626.  
  1627.  
  1628.             };
  1629.  
  1630.  
  1631.  
  1632. if (gval.leg4 != 0xFF) { 
  1633.  
  1634.  
  1635.  
  1636.                         param_leg4 = ((float)gval.leg4 / 254.0f); 
  1637.  
  1638.             temp = param_leg4 * param_leg4;
  1639.  
  1640.             coefs[0][9] = 0.375f * param_leg4ret;
  1641.  
  1642.             coefs[2][9] = -3.75f * temp * param_leg4ret;
  1643.  
  1644.             coefs[4][9] = 4.375f * temp * temp * param_leg4ret;
  1645.  
  1646.  
  1647.  
  1648.             };
  1649.  
  1650.  
  1651.  
  1652. if (gval.leg5 != 0xFF) { 
  1653.  
  1654.  
  1655.  
  1656.                         param_leg5 = ((float)gval.leg5 / 254.0f); 
  1657.  
  1658.             temp = param_leg5 * param_leg5;
  1659.  
  1660.             coefs[1][10] = 1.875f * param_leg5 * param_leg5ret;
  1661.  
  1662.             coefs[3][10] = -8.75f * temp * param_leg5 * param_leg5ret;
  1663.  
  1664.             coefs[5][10] = 7.875f * temp * temp * param_leg5 * param_leg5ret;
  1665.  
  1666.  
  1667.  
  1668.             };
  1669.  
  1670.  
  1671.  
  1672. if (gval.leg6 != 0xFF) { 
  1673.  
  1674.  
  1675.  
  1676.                         param_leg6 = ((float)gval.leg6 / 254.0f); 
  1677.  
  1678.             temp = param_leg6 * param_leg6;
  1679.  
  1680.             coefs[0][11] = 0.3125f * param_leg6ret;
  1681.  
  1682.             coefs[2][11] = 6.5625f * temp * param_leg6ret;
  1683.  
  1684.             coefs[4][11] = -19.6875f * temp * temp * param_leg6ret;
  1685.  
  1686.             coefs[6][11] = 14.4375f * temp * temp * temp * param_leg6ret;
  1687.  
  1688.  
  1689.  
  1690.             };
  1691.  
  1692.  
  1693.  
  1694. if (gval.leg7 != 0xFF) { 
  1695.  
  1696.  
  1697.  
  1698.                         param_leg7 = ((float)gval.leg7 / 254.0f); 
  1699.  
  1700.             temp = param_leg7 * param_leg7;
  1701.  
  1702.             coefs[0][12] = 15.3125f * param_leg7ret;
  1703.  
  1704.             coefs[3][12] = 127.96875f * temp * param_leg7 * param_leg7ret;
  1705.  
  1706.             coefs[5][12] = -238.21875f * temp * temp * param_leg7 * param_leg7ret;
  1707.  
  1708.             coefs[7][12] = 147.46875f * temp * temp * temp * param_leg7 * param_leg7ret;
  1709.  
  1710.  
  1711.  
  1712.             };
  1713.  
  1714.  
  1715.  
  1716. if (gval.leg8 != 0xFF) { 
  1717.  
  1718.  
  1719.  
  1720.                         param_leg8 = ((float)gval.leg8 / 254.0f); 
  1721.  
  1722.             temp = param_leg8 * param_leg8;
  1723.  
  1724.             coefs[0][13] = 10.1171875f * param_leg8ret;
  1725.  
  1726.             coefs[2][13] = -324.84375f * temp * param_leg8ret;
  1727.  
  1728.             coefs[4][13] = 1786.640625f * temp * temp * param_leg8ret;
  1729.  
  1730.             coefs[6][13] = -2721.46875f * temp * temp * temp * param_leg8ret;
  1731.  
  1732.             coefs[8][13] = 1457.9296875f * temp * temp * temp * temp * param_leg8ret;
  1733.  
  1734.  
  1735.  
  1736.             };
  1737.  
  1738.  
  1739.  
  1740. if (gval.leg2ret != 0xFF) { 
  1741.  
  1742.  
  1743.  
  1744.                         param_leg2ret = ((float)gval.leg2ret / 254.0f); 
  1745.  
  1746.             coefs[0][7] = -0.5f * param_leg2ret;
  1747.  
  1748.             coefs[2][7] = 1.5f * param_leg2 * param_leg2 * param_leg2ret;
  1749.  
  1750.             };
  1751.  
  1752.  
  1753.  
  1754. if (gval.leg3ret != 0xFF) { 
  1755.  
  1756.  
  1757.  
  1758.                         param_leg3ret = ((float)gval.leg3ret / 254.0f); 
  1759.  
  1760.             coefs[1][8] = -3.0f * param_leg3 * param_leg3ret;
  1761.  
  1762.             coefs[3][8] = 2.5f * param_leg3 * param_leg3 * param_leg3 * param_leg3ret;
  1763.  
  1764.  
  1765.  
  1766.             };
  1767.  
  1768.  
  1769.  
  1770. if (gval.leg4ret != 0xFF) { 
  1771.  
  1772.  
  1773.  
  1774.                         param_leg4ret = ((float)gval.leg4ret / 254.0f); 
  1775.  
  1776.             temp = param_leg4 * param_leg4;
  1777.  
  1778.             coefs[0][9] = 0.375f * param_leg4ret;
  1779.  
  1780.             coefs[2][9] = -3.75f * temp * param_leg4ret;
  1781.  
  1782.             coefs[4][9] = 4.375f * temp * temp * param_leg4ret;
  1783.  
  1784.  
  1785.  
  1786.             };
  1787.  
  1788.  
  1789.  
  1790. if (gval.leg5ret != 0xFF) { 
  1791.  
  1792.  
  1793.  
  1794.                         param_leg5 = ((float)gval.leg5ret / 254.0f); 
  1795.  
  1796.             temp = param_leg5 * param_leg5;
  1797.  
  1798.             coefs[1][10] = 1.875f * param_leg5 * param_leg5ret;
  1799.  
  1800.             coefs[3][10] = -8.75f * temp * param_leg5 * param_leg5ret;
  1801.  
  1802.             coefs[5][10] = 7.875f * temp * temp * param_leg5 * param_leg5ret;
  1803.  
  1804.  
  1805.  
  1806.             };
  1807.  
  1808.  
  1809.  
  1810. if (gval.leg6ret != 0xFF) { 
  1811.  
  1812.  
  1813.  
  1814.                         param_leg6ret = ((float)gval.leg6ret / 254.0f); 
  1815.  
  1816.             temp = param_leg6 * param_leg6;
  1817.  
  1818.             coefs[0][11] = 0.3125f * param_leg6ret;
  1819.  
  1820.             coefs[2][11] = 6.5625f * temp * param_leg6ret;
  1821.  
  1822.             coefs[4][11] = -19.6875f * temp * temp * param_leg6ret;
  1823.  
  1824.             coefs[6][11] = 14.4375f * temp * temp * temp * param_leg6ret;
  1825.  
  1826.  
  1827.  
  1828.             };
  1829.  
  1830.  
  1831.  
  1832. if (gval.leg7ret != 0xFF) { 
  1833.  
  1834.  
  1835.  
  1836.                         param_leg7ret = ((float)gval.leg7ret / 254.0f); 
  1837.  
  1838.             temp = param_leg7 * param_leg7;
  1839.  
  1840.             coefs[0][12] = 15.3125f * param_leg7ret;
  1841.  
  1842.             coefs[3][12] = 127.96875f * temp * param_leg7 * param_leg7ret;
  1843.  
  1844.             coefs[5][12] = -238.21875f * temp * temp * param_leg7 * param_leg7ret;
  1845.  
  1846.             coefs[7][12] = 147.46875f * temp * temp * temp * param_leg7 * param_leg7ret;
  1847.  
  1848.  
  1849.  
  1850.             };
  1851.  
  1852.  
  1853.  
  1854. if (gval.leg8ret != 0xFF) { 
  1855.  
  1856.  
  1857.  
  1858.                         param_leg8ret = ((float)gval.leg8ret / 254.0f); 
  1859.  
  1860.             temp = param_leg8 * param_leg8;
  1861.  
  1862.             coefs[0][13] = 10.1171875f * param_leg8ret;
  1863.  
  1864.             coefs[2][13] = -324.84375f * temp * param_leg8ret;
  1865.  
  1866.             coefs[4][13] = 1786.640625f * temp * temp * param_leg8ret;
  1867.  
  1868.             coefs[6][13] = -2721.46875f * temp * temp * temp * param_leg8ret;
  1869.  
  1870.             coefs[8][13] = 1457.9296875f * temp * temp * temp * temp * param_leg8ret;
  1871.  
  1872.  
  1873.  
  1874.             };
  1875.  
  1876.  
  1877.  
  1878. if (gval.dry != 0xFF) { 
  1879.  
  1880.  
  1881.  
  1882.                         param_dry = ((float)gval.dry / 254.0f); 
  1883.  
  1884.  
  1885.  
  1886.             };
  1887.  
  1888.  
  1889.  
  1890. if (gval.wet != 0xFF) { 
  1891.  
  1892.  
  1893.  
  1894.                         param_wet = ((float)gval.wet / 254.0f); 
  1895.  
  1896.  
  1897.  
  1898.             };
  1899.  
  1900.  
  1901.  
  1902. if (gval.ingain != 0xFF) { 
  1903.  
  1904.  
  1905.  
  1906.                         param_ingain = ((float)gval.ingain / 127.0f); 
  1907.  
  1908.  
  1909.  
  1910.             };
  1911.  
  1912.  
  1913.  
  1914. if (gval.inclip != 0xFF) { 
  1915.  
  1916.  
  1917.  
  1918.                         param_inclip = ((int)gval.inclip); 
  1919.  
  1920.  
  1921.  
  1922.             };
  1923.  
  1924.  
  1925.  
  1926. if (gval.outclip != 0xFF) { 
  1927.  
  1928.  
  1929.  
  1930.                         param_outclip = ((int)gval.outclip); 
  1931.  
  1932.  
  1933.  
  1934.             };
  1935.  
  1936.  
  1937.  
  1938.  
  1939.  
  1940.  
  1941.  
  1942.  
  1943.  
  1944.  
  1945. }
  1946.  
  1947.  
  1948.  
  1949.  
  1950. bool mi::MDKWork(float *psamples, int numsamples, int const mode)
  1951.  
  1952. {
  1953.  
  1954.             return false;
  1955.  
  1956. }
  1957.  
  1958.  
  1959.  
  1960. bool mi::MDKWorkStereo(float *psamples, int numsamples, int const mode)
  1961.  
  1962. {
  1963.  
  1964.             if (mode==WM_WRITE)
  1965.  
  1966.                         return false;
  1967.  
  1968.             if (mode==WM_NOIO)
  1969.  
  1970.                         return false;
  1971.  
  1972.             if (mode==WM_READ)                        // <thru>
  1973.  
  1974.                         return true;
  1975.  
  1976.  
  1977.  
  1978.             float inL, inR, outL, outR, xL, xR, xL2, xR2, xL4, xR4;
  1979.     int            i;
  1980.  
  1981.             float on;
  1982. int madeanoise = 0;
  1983.  
  1984.             on = param_dry + param_cheb2ret + param_cheb3ret + param_cheb4ret + param_cheb5ret + param_cheb6ret + param_cheb7ret + param_cheb8ret + param_leg2ret + param_leg3ret + param_leg4ret + param_leg5ret + param_leg6ret + param_leg7ret + param_leg8ret;
  1985.  
  1986.             if(on){
  1987.             for( i=0; i<numsamples*2; i++ ) {
  1988.  
  1989.  
  1990.  
  1991.                         inL = psamples[i] * param_ingain;
  1992.  
  1993.                         inR = psamples[i+1] * param_ingain;
  1994.  
  1995.  
  1996.  
  1997.  
  1998.  
  1999.             xL = inL * 0.000030517578125f; // = 1/32768
  2000.  
  2001.             xR = inR * 0.000030517578125f;
  2002.  
  2003.             if(xL > 1.0f) xL = 1.0f; //hardclip input (always)
  2004.             if(xL < -1.0f) xL = -1.0f;
  2005.             
  2006.             if(xR > 1.0f) xR = 1.0f;
  2007.             if(xR < -1.0f) xR = -1.0f;
  2008.  
  2009.  
  2010.     if(param_inclip > 0) { //softclipper
  2011.     xL = (xL * (1.5f - (0.5f * xL * xL)));
  2012.     xR = (xR * (1.5f - (0.5f * xR * xR)));
  2013.     }
  2014.  
  2015.             xL2 = (xL * xL) + tiny;
  2016.  
  2017.  
  2018.             xL4 = (xL2 * xL2) + tiny;
  2019.  
  2020.             xR2 = (xR * xR) + tiny;
  2021.  
  2022.             xR4 = (xR2 * xR2) + tiny;
  2023.  
  2024.  
  2025.  
  2026.                         outL = 0.0f;
  2027.  
  2028.                         outR = 0.0f;
  2029.  
  2030.  
  2031.  
  2032.  
  2033.  
  2034. if (param_cheb2ret != 0){
  2035.  
  2036. if(param_cheb2 != 0) {
  2037.  
  2038. outL += ((xL2 * coefs[2][0]) + coefs[0][0]);
  2039.  
  2040. outR += ((xR2 * coefs[2][0]) + coefs[0][0]);
  2041.  
  2042.  
  2043.  
  2044. }
  2045.  
  2046. }
  2047.  
  2048.  
  2049.  
  2050. if (param_cheb3ret != 0){
  2051.  
  2052. if(param_cheb3 != 0) {
  2053.  
  2054. outL += (xL * ((coefs[1][1]) + (xL2 * coefs[3][1])));
  2055.  
  2056. outR += (xR * ((coefs[1][1]) + (xR2 * coefs[3][1])));
  2057.  
  2058. }
  2059.  
  2060. }
  2061.  
  2062.  
  2063.  
  2064. if (param_cheb4ret != 0){
  2065.  
  2066. if(param_cheb4 != 0) {
  2067.  
  2068. outL += (coefs[0][2] + (xL2 * coefs[2][2]) + (xL4 * coefs[4][2]));
  2069.  
  2070. outR += (coefs[0][2] + (xR2 * coefs[2][2]) + (xR4 * coefs[4][2]));
  2071.  
  2072. }
  2073.  
  2074. }
  2075.  
  2076.  
  2077.  
  2078. if (param_cheb5ret != 0){
  2079.  
  2080. if(param_cheb5 != 0) {
  2081.  
  2082. outL += xL * ((coefs[1][3]) + (xL2 * coefs[3][3]) + (xL4 * coefs[5][3]));
  2083.  
  2084. outR += xR * ((coefs[1][3]) + (xR2 * coefs[3][3]) + (xR4 * coefs[5][3]));
  2085.  
  2086. }
  2087.  
  2088. }
  2089.  
  2090.  
  2091.  
  2092. if (param_cheb6ret != 0){
  2093.  
  2094. if(param_cheb6 != 0) {
  2095.  
  2096. outL += (coefs[0][4] + (xL2 * ((coefs[2][4]) + (xL2 * coefs[4][4]) + (xL4 * coefs[6][4]))));
  2097.  
  2098. outR += (coefs[0][4] + (xR2 * ((coefs[2][4]) + (xR2 * coefs[4][4]) + (xL4 * coefs[6][4]))));
  2099.  
  2100. }
  2101.  
  2102. }
  2103.  
  2104.  
  2105.  
  2106. if (param_cheb7ret != 0){
  2107.  
  2108. if(param_cheb7 != 0) {
  2109.  
  2110. outL += xL * ((coefs[1][5]) + (xL2 * coefs[3][5]) + (xL4 * ((coefs[5][5]) + (xL2 * coefs[7][5]))));
  2111.  
  2112. outR += xR * ((coefs[1][5]) + (xR2 * coefs[3][5]) + (xR4 * ((coefs[5][5]) + (xR2 * coefs[7][5]))));
  2113.  
  2114. }
  2115.  
  2116. }
  2117.  
  2118.  
  2119.  
  2120. if (param_cheb8ret != 0){
  2121.  
  2122. if(param_cheb8 != 0) {
  2123.  
  2124. outL += (coefs[0][6] + (xL2 * ((coefs[2][6]) + (xL2 * coefs[4][6]) + (xL4 * ((coefs[6][6]) + (xL2 * coefs[8][6]))))));
  2125.  
  2126. outR += (coefs[0][6] + (xR2 * ((coefs[2][6]) + (xR2 * coefs[4][6]) + (xR4 * ((coefs[6][6]) + (xR2 * coefs[8][6]))))));
  2127.  
  2128. }
  2129.  
  2130. }
  2131.  
  2132.  
  2133.  
  2134. if (param_leg2ret != 0){
  2135.  
  2136. if(param_leg2 != 0) {
  2137.  
  2138. outL += (coefs[0][7] + (xL2 * coefs[2][7]));
  2139.  
  2140. outR += (coefs[0][7] + (xR2 * coefs[2][7]));
  2141.  
  2142. }
  2143.  
  2144. }
  2145.  
  2146.  
  2147.  
  2148. if (param_leg3ret != 0){
  2149.  
  2150. if(param_leg3 != 0) {
  2151.  
  2152. outL += (xL * ((coefs[1][8]) + (xL2 * coefs[3][8])));
  2153.  
  2154. outR += (xR * ((coefs[1][8]) + (xR2 * coefs[3][8])));
  2155.  
  2156. }
  2157.  
  2158. }
  2159.  
  2160.  
  2161.  
  2162. if (param_leg4ret != 0){
  2163.  
  2164. if(param_leg4 != 0) {
  2165.  
  2166. outL += (coefs[0][9] + (xL2 * ((coefs[2][9]) + (xL2 * coefs[4][9]))));
  2167.  
  2168. outR += (coefs[0][9] + (xR2 * ((coefs[2][9]) + (xR2 * coefs[4][9]))));
  2169.  
  2170. }
  2171.  
  2172. }
  2173.  
  2174.  
  2175.  
  2176. if (param_leg5ret != 0){
  2177.  
  2178. if(param_leg5 != 0) {
  2179.  
  2180. outL += xL * ((coefs[1][10]) + (xL2 * ((coefs[3][10]) + (xL2 * coefs[5][10]))));
  2181.  
  2182. outR += xR * ((coefs[1][10]) + (xR2 * ((coefs[3][10]) + (xR2 * coefs[5][10]))));
  2183.  
  2184. }
  2185.  
  2186. }
  2187.  
  2188.  
  2189.  
  2190. if (param_leg6ret != 0){
  2191.  
  2192. if(param_leg6 != 0) {
  2193.  
  2194. outL += (coefs[0][11] + (xL2 * ((coefs[2][11]) + (xL2 * ((coefs[4][11]) + (xL2 * coefs[6][11]))))));
  2195.  
  2196. outR += (coefs[0][11] + (xR2 * ((coefs[2][11]) + (xR2 * ((coefs[4][11]) + (xR2 * coefs[6][11]))))));
  2197.  
  2198. }
  2199.  
  2200. }
  2201.  
  2202.  
  2203.  
  2204. if (param_leg7ret != 0){
  2205.  
  2206. if(param_leg7 != 0) {
  2207.  
  2208. outL += (coefs[0][12] + (xL * ((xL2 * coefs[3][12]) + (xL4 * ((coefs[5][12]) + (xL2 * coefs[7][12]))))));
  2209.  
  2210. outR += (coefs[0][12] + (xR * ((xR2 * coefs[3][12]) + (xR4 * ((coefs[5][12]) + (xR2 * coefs[7][12]))))));
  2211.  
  2212. }
  2213.  
  2214. }
  2215.  
  2216.  
  2217.  
  2218. if (param_leg8ret != 0){
  2219.  
  2220. if(param_leg8 != 0) {
  2221.  
  2222. outL += (coefs[0][13] + (xL2 * ((coefs[2][13]) + (xL2 * coefs[4][13]) + (xL4 * ((coefs[6][13]) + (xL2 * coefs[8][13]))))));
  2223.  
  2224. outR += (coefs[0][13] + (xR2 * ((coefs[2][13]) + (xR2 * coefs[4][13]) + (xR4 * ((coefs[6][13]) + (xR2 * coefs[8][13]))))));
  2225.  
  2226. }
  2227.  
  2228. }
  2229.  
  2230. outL = outL * (param_wet);
  2231. outR = outR * (param_wet);
  2232.  
  2233.  
  2234. if (param_dry > 0) {outL += (xL * param_dry);                      
  2235.                     outR += (xR * param_dry);}                      
  2236.  
  2237. //hardclip output, always
  2238.  
  2239. if(outL > 1.0f) outL = 1.0f;
  2240. if(outL < -1.0f) outL = -1.0f;
  2241. if(outR > 1.0f) outR = 1.0f;
  2242. if(outR < -1.0f) outR = -1.0f;
  2243.  
  2244. if(param_outclip > 0) { //softclipper
  2245.     outL = (outL * (1.5f - (0.5f * outL * outL)));
  2246.     outR = (outR * (1.5f - (0.5f * outR * outR)));
  2247. }
  2248.  
  2249. outL = outL * 32768.0f;
  2250. outR = outR * 32768.0f;
  2251.  
  2252. //DC filter
  2253.  
  2254. dcspeedL = dcspeedL + (outL - dcposL) * 0.000004567f;
  2255. dcposL = dcposL + dcspeedL;
  2256. dcspeedL = dcspeedL * 0.96f;
  2257. outL = (outL - dcposL);
  2258.  
  2259. dcspeedR = dcspeedR + (outR - dcposR) * 0.000004567f;
  2260. dcposR = dcposR + dcspeedR;
  2261. dcspeedR = dcspeedR * 0.96f;
  2262. outR = (outR - dcposR);
  2263.  
  2264.  
  2265. if(outL != 0) madeanoise = 1;
  2266. if(outR != 0) madeanoise = 1;
  2267.  
  2268.                         psamples[i] = outL;
  2269.                         i++;
  2270.  
  2271.                         psamples[i] = outR;
  2272.  
  2273.             };
  2274.  
  2275.  
  2276.     if(madeanoise) {return true;}
  2277.     else{return false;} //because all of the samples were 0, switch the machine off
  2278.  
  2279. }else{         //i.e. if on=0; this is from the if statement right at the start
  2280.     return false;
  2281. } //end else
  2282.  
  2283. } //end Work function
  2284.  
  2285.  
  2286.  
  2287. void mi::Command(int const i)
  2288.  
  2289. {
  2290.  
  2291.             switch (i)
  2292.  
  2293.             {
  2294.  
  2295.             case 0:
  2296.  
  2297.                         MessageBox(NULL,"Edsca Migraine\n\n(c) Edward Earl, Oct 2001\nThanks: Rymix, Cyanphase\nmachine@emaajne.freeserve.co.uk\n\n","About Migraine",MB_OK|MB_SYSTEMMODAL);
  2298.  
  2299.                         break;
  2300.  
  2301.             default:
  2302.  
  2303.                         break;
  2304.  
  2305.             }
  2306.  
  2307. }
  2308.  
  2309. char const *mi::DescribeValue(int const param, int const value)
  2310.  
  2311. {
  2312.  
  2313.             static char txt[16];
  2314.  
  2315.             switch(param)        //!!!!!!!!! There MUST be a better way of doing this
  2316.  
  2317.             {
  2318.  
  2319.  case 0:    //Ingain
  2320.  
  2321.                         sprintf(txt,"%.1f%%", (((float)value / 127.0f) * 100.0f) );
  2322.  
  2323.                         return txt;
  2324.  
  2325.                         break;
  2326.  
  2327. case 1:        //Inclip
  2328.  
  2329.                         
  2330.             return NULL;        //!!!!!!!! Please work
  2331.  
  2332.                         break;
  2333.  
  2334. case 2:        //Cheb2 amount
  2335.  
  2336.                         sprintf(txt,"%.1f%%", ((float)value / 254.0f * 100.0f) );
  2337.  
  2338.                         return txt;
  2339.  
  2340.                         break;
  2341.  
  2342. case 3:        //Cheb2 ret
  2343.  
  2344.                         sprintf(txt,"%.1f%%", ((float)value / 254.0f * 100.0f) );
  2345.  
  2346.                         return txt;
  2347.  
  2348.                         break;
  2349.  
  2350. case 4:        //Cheb3 amount
  2351.  
  2352.                         sprintf(txt,"%.1f%%", ((float)value / 254.0f * 100.0f) );
  2353.  
  2354.                         return txt;
  2355.  
  2356.                         break;
  2357.  
  2358. case 5:        //Cheb3 ret
  2359.  
  2360.                         sprintf(txt,"%.1f%%", ((float)value / 254.0f * 100.0f) );
  2361.  
  2362.                         return txt;
  2363.  
  2364.                         break;
  2365.  
  2366. case 6:        //Cheb4 amount
  2367.  
  2368.                         sprintf(txt,"%.1f%%", ((float)value / 254.0f * 100.0f) );
  2369.  
  2370.                         return txt;
  2371.  
  2372.                         break;
  2373.  
  2374. case 7:        //Cheb4 ret
  2375.  
  2376.                         sprintf(txt,"%.1f%%", ((float)value / 254.0f * 100.0f) );
  2377.  
  2378.                         return txt;
  2379.  
  2380.                         break;
  2381.  
  2382. case 8:        //Cheb5 amount
  2383.  
  2384.                         sprintf(txt,"%.1f%%", ((float)value / 254.0f * 100.0f) );
  2385.  
  2386.                         return txt;
  2387.  
  2388.                         break;
  2389.  
  2390. case 9:        //Cheb5 ret
  2391.  
  2392.                         sprintf(txt,"%.1f%%", ((float)value / 254.0f * 100.0f) );
  2393.  
  2394.                         return txt;
  2395.  
  2396.                         break;
  2397.  
  2398. case 10:        //Cheb6 amount
  2399.  
  2400.                         sprintf(txt,"%.1f%%", ((float)value / 254.0f * 100.0f) );
  2401.  
  2402.                         return txt;
  2403.  
  2404.                         break;
  2405.  
  2406. case 11:        //Cheb6 ret
  2407.  
  2408.                         sprintf(txt,"%.1f%%", ((float)value / 254.0f * 100.0f) );
  2409.  
  2410.                         return txt;
  2411.  
  2412.                         break;
  2413.  
  2414. case 12:        //Cheb7 amount
  2415.  
  2416.                         sprintf(txt,"%.1f%%", ((float)value / 254.0f * 100.0f) );
  2417.  
  2418.                         return txt;
  2419.  
  2420.                         break;
  2421.  
  2422. case 13:        //Cheb7 ret
  2423.  
  2424.                         sprintf(txt,"%.1f%%", ((float)value / 254.0f * 100.0f) );
  2425.  
  2426.                         return txt;
  2427.  
  2428.                         break;
  2429.  
  2430. case 14:        //Cheb8 amount
  2431.  
  2432.                         sprintf(txt,"%.1f%%", ((float)value / 254.0f * 100.0f) );
  2433.  
  2434.                         return txt;
  2435.  
  2436.                         break;
  2437.  
  2438. case 15:        //Cheb8 ret
  2439.  
  2440.                         sprintf(txt,"%.1f%%", ((float)value / 254.0f * 100.0f) );
  2441.  
  2442.                         return txt;
  2443.  
  2444.                         break;
  2445.  
  2446. case 16:        //Leg2 amount
  2447.  
  2448.                         sprintf(txt,"%.1f%%", ((float)value / 254.0f * 100.0f));
  2449.  
  2450.                         return txt;
  2451.  
  2452.                         break;
  2453.  
  2454. case 17:        //Leg2 ret
  2455.  
  2456.                         sprintf(txt,"%.1f%%", ((float)value / 254.0f * 100.0f) );
  2457.  
  2458.                         return txt;
  2459.  
  2460.                         break;
  2461.  
  2462. case 18:        //Leg3 amount
  2463.  
  2464.                         sprintf(txt,"%.1f%%", ((float)value / 254.0f * 100.0f));
  2465.  
  2466.                         return txt;
  2467.  
  2468.                         break;
  2469.  
  2470. case 19:        //Leg3 ret
  2471.  
  2472.                         sprintf(txt,"%.1f%%", ((float)value / 254.0f * 100.0f) );
  2473.  
  2474.                         return txt;
  2475.  
  2476.                         break;
  2477.  
  2478. case 20:        //Leg4 amount
  2479.  
  2480.                         sprintf(txt,"%.1f%%", ((float)value / 254.0f * 100.0f));
  2481.  
  2482.                         return txt;
  2483.  
  2484.                         break;
  2485.  
  2486. case 21:        //Leg4 ret
  2487.  
  2488.                         sprintf(txt,"%.1f%%", ((float)value / 254.0f * 100.0f) );
  2489.  
  2490.                         return txt;
  2491.  
  2492.                         break;
  2493.  
  2494. case 22:        //Leg5 amount
  2495.  
  2496.                         sprintf(txt,"%.1f%%", ((float)value / 254.0f * 100.0f));
  2497.  
  2498.                         return txt;
  2499.  
  2500.                         break;
  2501.  
  2502. case 23:        //Leg5 ret
  2503.  
  2504.                         sprintf(txt,"%.1f%%", ((float)value / 254.0f * 100.0f) );
  2505.  
  2506.                         return txt;
  2507.  
  2508.                         break;
  2509.  
  2510. case 24:        //Leg6 amount
  2511.  
  2512.                         sprintf(txt,"%.1f%%", ((float)value / 254.0f * 100.0f));
  2513.  
  2514.                         return txt;
  2515.  
  2516.                         break;
  2517.  
  2518. case 25:        //Leg6 ret
  2519.  
  2520.                         sprintf(txt,"%.1f%%", ((float)value / 254.0f * 100.0f) );
  2521.  
  2522.                         return txt;
  2523.  
  2524.                         break;
  2525.  
  2526. case 26:        //Leg7 amount
  2527.  
  2528.                         sprintf(txt,"%.1f%%", ((float)value / 254.0f * 100.0f));
  2529.  
  2530.                         return txt;
  2531.  
  2532.                         break;
  2533.  
  2534. case 27:        //Leg7 ret
  2535.  
  2536.                         sprintf(txt,"%.1f%%", ((float)value / 254.0f * 100.0f) );
  2537.  
  2538.                         return txt;
  2539.  
  2540.                         break;
  2541.  
  2542. case 28:        //Leg8 amount
  2543.  
  2544.                         sprintf(txt,"%.1f%%", ((float)value / 254.0f * 100.0f));
  2545.  
  2546.                         return txt;
  2547.  
  2548.                         break;
  2549.  
  2550. case 29:        //Leg8 ret
  2551.  
  2552.                         sprintf(txt,"%.1f%%", ((float)value / 254.0f * 100.0f) );
  2553.  
  2554.                         return txt;
  2555.  
  2556.                         break;
  2557.  
  2558. case 30:        //Dry out
  2559.  
  2560.                         sprintf(txt,"%.1f%%", ((float)value / 254.0f * 100.0f) );
  2561.  
  2562.                         return txt;
  2563.  
  2564.                         break;
  2565.  
  2566. case 31:        //Wet out
  2567.  
  2568.                         sprintf(txt,"%.1f%%", ((float)value / 254.0f * 100.0f) );
  2569.  
  2570.                         return txt;
  2571.  
  2572.                         break;
  2573.  
  2574. case 32:        //Outclip
  2575.  
  2576.              return NULL;
  2577.  
  2578.                         break;
  2579.  
  2580.  
  2581.  
  2582. default:
  2583.  
  2584.                         return NULL;
  2585.  
  2586.             }
  2587.  
  2588. }
  2589.  
  2590.  
  2591.  
  2592. #pragma optimize ("", on) 
  2593.  
  2594.  
  2595.  
  2596. DLL_EXPORTS
  2597.  
  2598.